const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')

const dataBaseDir = 'E:/code/electron/twinkle-settings/src/data/'

function getTimeBrightDB() {
    return low(new FileSync(dataBaseDir + 'time-bright.json'))
}

const db = getTimeBrightDB()

const data = db.read().value()

for (let key in data.weather) {
    const items = data.weather[key]
    if (Object.keys(items).length === 0) continue
    for (let i = items.length - 1; i >= 0; i--) {
        const item = items[i]
        if (item.time === "16:45") {
            items.splice(i, 1)
        }
    }
}

db.write()
